package com.api.gbhg.daiyanlu.DataPrintCopyUtil;

import com.api.gbhg.liwenjun.VersionFlowUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import weaver.conn.RecordSet;

/**
 * 海关养老保险缴费经费需求表剩余字段处理
 * Mr.dyl
 */
public class EndowmentUtil {
    public static final Logger LOGGER = LoggerFactory.getLogger(CommonMethod.class);

    //修改预算总金额
    public static boolean updateTotalBudgetAmount(String requestid, String workFlowId) {
        String flowTableName = VersionFlowUtil.getFlowTableName(workFlowId);
        RecordSet rs = new RecordSet();
        String StrSQL = "select * from " + flowTableName + "_dt2 where mainid=" + "(select id from " + flowTableName + " where requestid=" + requestid + ")"; //获取明细条1
        rs.executeQuery(StrSQL);
        LOGGER.info("-----------------修改预算总金额" + StrSQL + "------------------------");
        double yszje = 0;
        while (rs.next()) {
            yszje = yszje + rs.getDouble("hjwy");
        }
        int sydw = 0;
        int sfwdlhsdw = 0;
        RecordSet rsupd = new RecordSet();
        String sqlUpd = "update uf_jingfei_version set yszje=" + yszje + " where requestId=" + requestid;
        boolean falg = rsupd.executeUpdate(sqlUpd);
        return falg;
    }
}
